<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of customer_model
 *
 * @author Hadi
 */
class customer_model extends Default_My_Model{
    //put your code here
    function __construct() {
        parent::__construct();
    }
    
    public function getCustomer($whr){
        $QUERY = "SELECT * FROM master_customer WHERE id_customer is not null ".($whr ? " AND $whr " : "");
        $resulSet = $this->db->query($QUERY);
        return $resulSet;
    }
    
    public function getDetailCustomer($kode){
        return $this->get_object("SELECT * FROM master_customer WHERE id_customer = '$kode'");
    }
    
    public function getCustomerFromQuotation($kode){
        $QUERY = "SELECT c.* FROM data_quotation_to_cust q LEFT JOIN master_customer c ON c.id_customer = q.id_customer
                  WHERE q.id_quotation = ?";
        $resulSet = $this->db->query($QUERY, array($kode));
        return $resulSet;
    }
}

?>
